﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.ETL.WebApi.DataContracts.Query
{
    public class ActionResult<T>
    {
        public bool IsSuccess { get; set; }

        public int ErrorCode { get; set; }

        public string Message { get; set; }

        public T Data { get; set; }

        public string ActionVersion { get; set; }

        /// <summary>
        /// 构造一个没有错误的结果
        /// </summary>
        /// <param name="version"></param>
        /// <param name="data"></param>
        public ActionResult(T data)
        {
            this.ActionVersion = "1.0";
            IsSuccess = true;
            Data = data;
        }

        /// <summary>
        /// 构造一个没有错误的结果
        /// </summary>
        /// <param name="version"></param>
        /// <param name="data"></param>
        public ActionResult(string version, T data)
        {
            this.ActionVersion = version;
            IsSuccess = true;
            Data = data;
        }

        public ActionResult(bool isSccuess, int errorCode, string message, T data)
        {
            this.ActionVersion = "1.0";
            IsSuccess = isSccuess;
            ErrorCode = errorCode;
            Message = message;
            Data = data;
        }
        public ActionResult(string actionVersion, bool isSccuess, int errorCode, string message, T data)
        {
            this.ActionVersion = actionVersion;
            IsSuccess = isSccuess;
            ErrorCode = errorCode;
            Message = message;
            Data = data;
        }
    }

    public class PagedResult<T>
    {
        public int Page { get; set; }

        public int Start { get; set; }

        public int Limit { get; set; }

        public int Total
        {
            get;
            set;
        }

        public int Count { get; set; }


        public List<T> Items = new List<T>();
    }

    public class TaskExecLog
    {
        public Guid Id { get; set; }
        public Guid TaskId { get; set; }
        public int Result { get; set; }
        public string Message { get; set; }
        public DateTime CreatedTime { get; set; }
        public string TaskName { get; set; }
        public int Mode { get; set; }
    }
}
